//
//  SelectHeaderCell.m
//  Shengzhuli
//
//  Created by FXGuo on 17/3/29.
//  Copyright © 2017年 kamangkeji. All rights reserved.
//

#import "SelectHeaderCell.h"

@interface SelectHeaderCell()

@property (weak, nonatomic) IBOutlet UIView *selectView;
@property (weak, nonatomic) IBOutlet UILabel *nameLab;
@property (weak, nonatomic) IBOutlet UILabel *selectCountLab;
@property (weak, nonatomic) IBOutlet UIButton *InstructionsBtn;
@property (weak, nonatomic) IBOutlet UIButton *coverBtn;


@end

@implementation SelectHeaderCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (IBAction)selectClick:(UIButton *)btn
{
    btn.selected = !btn.selected;
    if (btn.selected) {
        self.selectView.backgroundColor = RGBColor(43, 201, 203);
        self.nameLab.textColor = RGBColor(43, 201, 203);
        self.InstructionsBtn.hidden = NO;
        self.selectCountLab.hidden = NO;
        self.model.isOpen = YES;
    }else{
        self.selectView.backgroundColor = [UIColor whiteColor];
        self.nameLab.textColor = [UIColor blackColor];
        self.InstructionsBtn.hidden = YES;
        self.selectCountLab.hidden = YES;
        self.model.isOpen = NO;
    }
    if (self.reloadBlock) {
        self.reloadBlock();
    }
}
- (void)setModel:(SourceModel *)model
{
    _model = model;
    self.nameLab.text = model.industryName;
    if (model.isOpen) {
        self.selectView.backgroundColor = RGBColor(43, 201, 203);
        self.nameLab.textColor = RGBColor(43, 201, 203);
        self.InstructionsBtn.hidden = NO;
        self.selectCountLab.hidden = NO;
        self.coverBtn.selected = YES;
        if (model.selectIds.count>0) {
            self.selectCountLab.text = [NSString stringWithFormat:@"已选%zd个",model.selectIds.count];
        }else{
            self.selectCountLab.text = @"";
        }
    }
}


@end
